How can I resolve the NameError indicating that 'years' is not defined in my Python code